import drawQrcode from '../../utils/weapp.qrcode.esm.js'

Page({
  data: {
    val: 'I\'m your dady'
  },
  onLoad() {
    drawQrcode({
      width: 200,
      height: 200,
      canvasId: 'myQrcode',
      text: 'I\'m your dady',
    })
  },
  /*onChange(e) {
    // console.log(e.detail.value)
    this.setData({
      val: e.detail.value
    })
  },*/
  creatQRCode() {
    // console.log(this.data.val)
    drawQrcode({
      width: 200,
      height: 200,
      canvasId: 'myQrcode',
      text: this.data.val,
      background: '#f0f',
      foreground: 'blue',
      // image: '../../images/list-active.png',
      image: {
        imageResource: '../../images/scan-icon.svg',
        dx: 70,
        dy: 70,
        dWidth: 60,
        dHeight: 60
      },
      callback(res) {
        console.log(res)
      }
    })
  }
})